{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">系统设置</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form form-container" action="{:url('admin/System/systemsave')}" method="post">
                    <div class="layui-form-item">
                        <label class="layui-form-label">轮播图1{$user}</label>
                        <div class="layui-input-block">
                            <input type="text" name="image[0]" value="{$info.image[0]}" placeholder="（选填）请上传图片" class="layui-input layui-input-inline">
                            <input type="file" name="file" class="layui-upload-file" data-type="0">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">轮播图2</label>
                        <div class="layui-input-block">
                            <input type="text" name="image[1]" value="{$info.image[1]}" placeholder="（选填）请上传图片" class="layui-input layui-input-inline">
                            <input type="file" name="file" class="layui-upload-file" data-type="1">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">轮播图3</label>
                        <div class="layui-input-block">
                            <input type="text" name="image[2]" value="{$info.image[2]}" placeholder="（选填）请上传图片" class="layui-input layui-input-inline">
                            <input type="file" name="file" class="layui-upload-file"  data-type="2">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">公告</label>
                        <div class="layui-input-block">
                            <textarea type="text" name="notice" value="{$info.notice}" rows="5" cols="40" placeholder="请填写公告" class="">{$info.notice}</textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="*">保存</button>
                            <!--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script>
    $(function(){
        $('.layui-upload-file').click(function () {
            var id=this.dataset.type;
            layui.upload({
                url: "/index.php/api/upload/upload",
                type: 'image',
                ext: 'jpg|png|gif|bmp',
                success: function (data) {
                    if (data.error === 0) {
                        if(id=='0'){
                            $("input[name='image[0]']").val(data.url);
                        }else if(id=='1'){
                            $("input[name='image[1]']").val(data.url);
                        }else if(id=='2'){
                            $("input[name='image[2]']").val(data.url);
                        }
                    } else {
                        layer.msg(data.message);
                    }
                }
            });
        });
    });
</script>
{/block}